package com.aar.rest.util;


import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	static {
		try {
			sessionFactory = new Configuration().configure()
					.buildSessionFactory();
		} catch (Throwable ex) {
			System.err.println("Initial SessionFactory creation failed." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	
	public static void main(String []args){
        new HibernateUtil();
	}
	
	public static String template(String core){
		String template = "<html>" +
				"<head><style type=\"text/css\">" +
				"body {background-color:#DDD;color:#048}" +
				"p {font-size: 12px;line-height: 16px;}" +
				"h1, h2, h3, h4, h5, h6 {font-weight:lighter;}" +
				"#footer {text-align:center; background-color:#CCC; border-radius: 10px;padding: 4px;padding-top: 10px;margin-top: 30px;}" +
				"#menu {background-color:#CCC;border-radius: 10px;}" +
				"a {	color: #028;}" +
				".container{width: 940px;}" +
				".span2 { width: 140px;}" +
				".span10 { width: 300px;}" +
				".span12 { width: 940px;}" +
				".page-header {padding-bottom: 9px; margin: 20px 0 30px; border-bottom: 1px solid #eeeeee;}" +
				"ul,ol {padding: 0;margin: 0 0 10px 25px;}li {line-height: 20px;}" +
				".row {  margin-left: 20px;  *zoom: 1;}" +
				".nav li + .nav-header {  margin-top: 9px;}" +
				".nav-list {  padding-right: 15px;  padding-left: 15px;  margin-bottom: 0;}" +
				".nav-list > li > a,.nav-list " +
				".nav-header {margin-right: -15px;  margin-left: -15px;  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);}" +
				".nav-list > li > a {  padding: 3px 15px;}" +
				"table {  max-width: 100%;  background-color: transparent;  border-collapse: collapse;  border-spacing: 0;}" +
				".table th,.table td {  padding: 8px;  text-align: left;  vertical-align: top;  border-top: 1px solid #dddddd;}" +
				"</style><title></title></head>" +
				"<body>" +
				"<div class=\"container\">" +
				"<div>" +
				"	<div class=\"span12\">" +
				"			<div class=\"page-header\">" +
				"				<h1>Gestion des commandes</h1>" +
				"			</div>" +
				"		</div>" +
				"	</div>" +
				"	<div>" +
				"		<div class=\"span2\" id=\"menu\">" +
				"			<ul class=\"nav nav-list\">" +
				"				<li><a href=\"http://localhost:9999/aar/annee/enfants\">Gerer les enfants</a></li>" +
				"			</ul>" +
				"			<ul class=\"nav nav-list\">" +
				"				<li><a href=\"http://localhost:8080/PROJET-HAMEK-SAIDI-ARR/newChild.html\">Creation de compte</a></li>" +
				"			</ul>" +
				"			<ul class=\"nav nav-list\">" +
				"				<li><a href=\"http://localhost:8080/PROJET-HAMEK-SAIDI-ARR/searchChild.html\">Chercher un enfant</a></li>" +
				"			</ul>" +
				"			<ul class=\"nav nav-list\">" +
				"				<li><a href=\"http://localhost:8080/PROJET-HAMEK-SAIDI-ARR/searchGift.html\">Chercher un cadeau</a></li>" +
				"			</ul>" +
				"		</div>" +
				"		<div class=\"span10\">" + core +
				"		</div>" +
				"		<div>" +
				"			<div class= \"span12 \" id= \"footer \">" +
				"				<p>Copyright &copy; 2013 gestion-commande.fr Tous droits réservés</p>" +
				"			</div>" +
				"		</div>" +
				"	</div></div>" +
				"</body></html>";
		return template;
	}
}